Skip to content

gh-146102:Fix cross-interpreter NotShareableError ref handling - #151578

Open
lpyu001 wants to merge 3 commits into
python:mainfrom
lpyu001:fix-crossinterp.c-bug2
Open

lpyu001 wants to merge 3 commits into
python:mainfrom
lpyu001:fix-crossinterp.c-bug2

Conversation

@lpyu001

@lpyu001 lpyu001 commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

This fixes two ownership issues:

  • _ensure_notshareableerror() now returns immediately when the current raised exception is already a NotShareableError. The function had restored ctx to the thread state but then continued using it, even though ownership had been handed back.
  • _PyXI_UnwrapNotShareableError() now decrefs the exception taken from the thread state if _PyXI_InitFailure() fails, avoiding a leaked exception reference on that error path.

The _pop_preserved() shadowed-variable leak is already fixed on this branch, so this PR does not touch it.

glist:https://gist.github.com/devdanzin/a56b8cb579b1950b4206e8a42d6be650

@aisk

aisk commented Jul 23, 2026

Copy link
Copy Markdown
Member

Since this is a user facing bug, could you add a simple NEWS entry, like the one in #153665?

@lpyu001

lpyu001 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Since this is a user facing bug, could you add a simple NEWS entry, like the one in #153665?

of course

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants